#include <lvgl.h>
#include <WiFi.h>
#include <HTTPClient.h>
#include <ESP32Time.h>
#include <Preferences.h>
#include "../../common.h"

extern const lv_img_dsc_t weather_icon;
extern const lv_img_dsc_t weather_0;
extern const lv_img_dsc_t weather_1;
extern const lv_img_dsc_t weather_2;
extern const lv_img_dsc_t weather_3;
extern const lv_img_dsc_t weather_4;
extern const lv_img_dsc_t weather_5;
extern const lv_img_dsc_t weather_6;
extern const lv_img_dsc_t weather_7;
extern const lv_img_dsc_t weather_8;
extern const lv_img_dsc_t weather_9;
extern const lv_img_dsc_t weather_10;
extern const lv_img_dsc_t weather_11;
extern const lv_img_dsc_t weather_12;
extern const lv_img_dsc_t weather_13;
extern const lv_img_dsc_t weather_14;
extern const lv_img_dsc_t weather_15;
extern const lv_img_dsc_t weather_16;
extern const lv_img_dsc_t weather_17;
extern const lv_img_dsc_t weather_18;
extern const lv_img_dsc_t weather_19;
extern const lv_img_dsc_t weather_20;
extern const lv_img_dsc_t weather_21;
extern const lv_img_dsc_t weather_22;
extern const lv_img_dsc_t weather_23;
extern const lv_img_dsc_t weather_24;
extern const lv_img_dsc_t weather_25;
extern const lv_img_dsc_t weather_26;
extern const lv_img_dsc_t weather_27;
extern const lv_img_dsc_t weather_28;
extern const lv_img_dsc_t weather_29;
extern const lv_img_dsc_t weather_30;
extern const lv_img_dsc_t weather_31;
extern const lv_img_dsc_t weather_32;
extern const lv_img_dsc_t weather_33;
extern const lv_img_dsc_t weather_34;
extern const lv_img_dsc_t weather_35;
extern const lv_img_dsc_t weather_36;
extern const lv_img_dsc_t weather_37;
extern const lv_img_dsc_t weather_38;
extern const lv_img_dsc_t weather_99;


class Weather
{
  private:
  lv_obj_t *scr, *label_city, *label_tem, *img;
  lv_style_t font_style_city, font_style_tem;
  String key, city_name, code, temperature;
  long timecal;
  Preferences save_cfg;
  Event event;
  void show_weather();
  bool update_weather();
  // lv_img_dsc_t weather_icon_list[40] = {weather_0, weather_1, weather_2, weather_3, weather_4, weather_5, weather_6, weather_7, weather_8, weather_9, 
  // weather_10, weather_11, weather_12, weather_13, weather_14, weather_15, weather_16, weather_17, weather_18, weather_19, weather_20, 
  // weather_21, weather_22, weather_23, weather_24, weather_25, weather_26, weather_27, weather_28, weather_29, 
  // weather_30, weather_31, weather_32, weather_33, weather_34, weather_35, weather_36, weather_37, weather_38, weather_99};
  
  
  public:
  Weather();
  ~Weather();
  Event main_process(Action);

};



